package com.ronghui.cash.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.ronghui.cash.entity.AuthLimu;
import com.ronghui.cash.entity.AuthProject;
import com.ronghui.cash.mapper.AuthProjectMapper;
import com.ronghui.cash.service.AuthLimuService;
import com.ronghui.cash.service.LimuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class LimuServiceImpl implements LimuService {

	@Autowired
	AuthLimuService authLimuService;

	@Autowired
	AuthProjectMapper authProjectMapper;

	@Override
	public AuthLimu selectByUserId(Long userId, String bizType) {
		return authLimuService.selectOne(new EntityWrapper<AuthLimu>().eq("user_id", userId).eq("biz_type", bizType));
	}

	@Override
	public void limuGetResultAndSaveData(AuthLimu authLimu, AuthProject authProject) {
		authLimuService.insert(authLimu);
		authProjectMapper.insert(authProject);
	}

}
